using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class SevenZip_CommandLineParser_SwitchResult_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(SevenZip.CommandLineParser.SwitchResult);

            field = type.GetField("ThereIs", flag);
            app.RegisterCLRFieldGetter(field, get_ThereIs_0);
            app.RegisterCLRFieldSetter(field, set_ThereIs_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_ThereIs_0, AssignFromStack_ThereIs_0);
            field = type.GetField("WithMinus", flag);
            app.RegisterCLRFieldGetter(field, get_WithMinus_1);
            app.RegisterCLRFieldSetter(field, set_WithMinus_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_WithMinus_1, AssignFromStack_WithMinus_1);
            field = type.GetField("PostStrings", flag);
            app.RegisterCLRFieldGetter(field, get_PostStrings_2);
            app.RegisterCLRFieldSetter(field, set_PostStrings_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_PostStrings_2, AssignFromStack_PostStrings_2);
            field = type.GetField("PostCharIndex", flag);
            app.RegisterCLRFieldGetter(field, get_PostCharIndex_3);
            app.RegisterCLRFieldSetter(field, set_PostCharIndex_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_PostCharIndex_3, AssignFromStack_PostCharIndex_3);


            app.RegisterCLRCreateDefaultInstance(type, () => new SevenZip.CommandLineParser.SwitchResult());
            app.RegisterCLRCreateArrayInstance(type, s => new SevenZip.CommandLineParser.SwitchResult[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }



        static object get_ThereIs_0(ref object o)
        {
            return ((SevenZip.CommandLineParser.SwitchResult)o).ThereIs;
        }

        static StackObject* CopyToStack_ThereIs_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.CommandLineParser.SwitchResult)o).ThereIs;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_ThereIs_0(ref object o, object v)
        {
            ((SevenZip.CommandLineParser.SwitchResult)o).ThereIs = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_ThereIs_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @ThereIs = ptr_of_this_method->Value == 1;
            ((SevenZip.CommandLineParser.SwitchResult)o).ThereIs = @ThereIs;
            return ptr_of_this_method;
        }

        static object get_WithMinus_1(ref object o)
        {
            return ((SevenZip.CommandLineParser.SwitchResult)o).WithMinus;
        }

        static StackObject* CopyToStack_WithMinus_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.CommandLineParser.SwitchResult)o).WithMinus;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_WithMinus_1(ref object o, object v)
        {
            ((SevenZip.CommandLineParser.SwitchResult)o).WithMinus = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_WithMinus_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @WithMinus = ptr_of_this_method->Value == 1;
            ((SevenZip.CommandLineParser.SwitchResult)o).WithMinus = @WithMinus;
            return ptr_of_this_method;
        }

        static object get_PostStrings_2(ref object o)
        {
            return ((SevenZip.CommandLineParser.SwitchResult)o).PostStrings;
        }

        static StackObject* CopyToStack_PostStrings_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.CommandLineParser.SwitchResult)o).PostStrings;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_PostStrings_2(ref object o, object v)
        {
            ((SevenZip.CommandLineParser.SwitchResult)o).PostStrings = (System.Collections.ArrayList)v;
        }

        static StackObject* AssignFromStack_PostStrings_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Collections.ArrayList @PostStrings = (System.Collections.ArrayList)typeof(System.Collections.ArrayList).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((SevenZip.CommandLineParser.SwitchResult)o).PostStrings = @PostStrings;
            return ptr_of_this_method;
        }

        static object get_PostCharIndex_3(ref object o)
        {
            return ((SevenZip.CommandLineParser.SwitchResult)o).PostCharIndex;
        }

        static StackObject* CopyToStack_PostCharIndex_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((SevenZip.CommandLineParser.SwitchResult)o).PostCharIndex;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_PostCharIndex_3(ref object o, object v)
        {
            ((SevenZip.CommandLineParser.SwitchResult)o).PostCharIndex = (System.Int32)v;
        }

        static StackObject* AssignFromStack_PostCharIndex_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @PostCharIndex = ptr_of_this_method->Value;
            ((SevenZip.CommandLineParser.SwitchResult)o).PostCharIndex = @PostCharIndex;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new SevenZip.CommandLineParser.SwitchResult();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
